/**
* @author AlbertDarren
* @contact 2563491540@qq.com
*/
#include <iostream>
#include <vector>
#include <list>
#include <deque>
#include <string>
#include <algorithm>
using namespace std;
void show(auto container,string sep=" ")
{
    for(auto ele:container)
    {
        cout << ele << " ";
    }
    cout   << endl;
}
int main_16()
{
    list<string> str_list({"Apple","Banana","Blueberry","Pear","Orange","Grapes","Strawberry"});
    show(str_list);
    cout << "delete the first element" << endl;
    str_list.pop_front();
    show(str_list);
    cout << "delete the last element" << endl;
    str_list.pop_back();
    show(str_list);
    string fruits[]= {"Pear","Watermelon"};
    for(string fruit:fruits)
    {
        auto iter=find(str_list.begin(),str_list.end(),fruit);
        if (iter!=str_list.end())
        {
            str_list.erase(iter);
            cout << fruit<<" Exist" << endl;
            cout << "delete "<<fruit << endl;
        }
        else
        {
            cout << fruit<< " doesn't exist" << endl;
        }
        show(str_list);
    }
    str_list.erase(++str_list.begin(),--str_list.end());
    cout << "delete a range" << endl;
    show(str_list);
    str_list.clear();
    cout << "clear" << endl;
    show(str_list);
    return 0;
}
